


import 'package:flutter/material.dart';

void main() {
  runApp(//这里时创建了一个runapp对象，本质上是new runapp(),new给省略了
      CLMyapp()
  );
}
class CLMyapp extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return MaterialApp(
        home: CLhome()
    );
  }
}
class CLhome extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    // TODO: implement build

    return Scaffold(
        appBar: AppBar(
          title:Text("第一个flutter程序") ,
        ),
        body: CLbody()
    );
  }
}
class CLbody extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return CLbodystatus();
  }
}
class CLbodystatus extends State<CLbody>{
  var flag = true;
  @override

  Widget build(BuildContext context) {
    // TODO: implement build
    return Center(
      child:  Row(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          Checkbox(

              value: flag,
              onChanged: (value){//这里的value参数是点击后的最新值
                setState(() {
                  flag = value!;//这里必须要有感叹号，确保它不是null
                });
              })
          ,
          const Text("同意协议",
              style: TextStyle(fontSize: 40)

          )
        ],
      ),
    );


  }
}